from rpc.pubsub_pb2 import mes2client, mes2server
from rpc.pubsub_pb2_grpc import pubsubStub
import grpc

def clientfunc():
    labels = set()
    while True:
        with grpc.insecure_channel('localhost:50000') as channel:

            stub = pubsubStub(channel)
            mes = stub.pubsubServer(mes2server(mes1='msg'), timeout = 500)

            if(mes.timelabel != 0 and mes.timelabel not in labels):
                print(mes.mes2)
                labels.add(mes.timelabel)

if __name__ == '__main__':
    clientfunc()